package com.acwing.partition37;

import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;

/**
 * @author rkc
 * @date 2022/8/24 9:06
 */
public class AC3675逃离迷宫 {

    private static final int N = 110;
    private static final int[][] dirs = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
    private static char[][] g = new char[N][N];
    private static int[][][] dist = new int[N][N][4];

    private static Queue<Node> q = new ArrayDeque<>(N * N);
    private static int n, m;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        int t = Integer.parseInt(reader.readLine());
        while (t-- > 0) {
            String[] ss = reader.readLine().split(" ");
            n = Integer.parseInt(ss[0]); m = Integer.parseInt(ss[1]);
            for (int i = 0; i < n; i++) {
                String s = reader.readLine();
                for (int j = 0; j < m; j++) {
                    g[i][j] = s.charAt(j);
                }
            }
            ss = reader.readLine().split(" ");
            int k = Integer.parseInt(ss[0]), x1 = Integer.parseInt(ss[1]), y1 = Integer.parseInt(ss[2]);
            int x2 = Integer.parseInt(ss[3]), y2 = Integer.parseInt(ss[4]);
            writer.write(bfs(k, y1 - 1, x1 - 1, y2 - 1, x2 - 1) + "\n");
        }
        writer.flush();
    }

    private static String bfs(int k, int x1, int y1, int x2, int y2) {
        q.clear();
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                Arrays.fill(dist[i][j], 0x3f3f3f3f);
            }
        }
        for (int i = 0; i < 4; i++) {
            q.add(new Node(x1, y1, i));
            dist[x1][y1][i] = 0;
        }
        while (!q.isEmpty()) {
            Node cur = q.poll();
            int x = cur.x, y = cur.y, d = cur.d;
            if (x == x2 && y == y2) return "yes";
            for (int i = 0; i < 4; i++) {
                int nx = x + dirs[i][0], ny = y + dirs[i][1];
                if (nx < 0 || nx >= n || ny < 0 || ny >= m || g[nx][ny] == '*' || (d != i && dist[x][y][d] + 1 > k)) continue;
                if (d == i && dist[nx][ny][i] > dist[x][y][d]) {
                    dist[nx][ny][i] = dist[x][y][d];
                    q.add(new Node(nx, ny, i));
                } else if (d != i && dist[nx][ny][i] > dist[x][y][d] + 1) {
                    dist[nx][ny][i] = dist[x][y][d] + 1;
                    q.add(new Node(nx, ny, i));
                }
            }
        }
        return "no";
    }

    private static class Node {
        private int x, y, d;

        public Node(int x, int y, int d) {
            this.x = x;
            this.y = y;
            this.d = d;
        }
    }
}
